function play(){
    console.log(123);
}

play()
play()
play()
play()
play()

/**
 * show()--->
 * show()-->
 * show()--->
 */
// function show(){
//     console.log("show");
//     if(time == "2023-10-24 12:00"){
//         return ;
//     }
//     show()
// }
// show()

//数组的扁平化 [{name:"蜗牛"},{name:"研发部"}]
let array = [
    {id:1,name:"蜗牛学苑",children:[
        {id:11,name:"研发部",children:[
            {id:111,name:"Java团队"}
        ]}
    ]}
]

/**
 * 第一次push temp=[{id:1,name:"蜗牛学苑"}]
 * 第二次push temp=[{id:1,name:"蜗牛学苑"},{id:11,name:"研发部"}，]
 */
let temp = []
function catArray(array){
    for (let index = 0; index < array.length; index++) {
        const element = array[index];
        temp.push({id:element.id,name:element.name})
        if(element.children){
            catArray(element.children)
        }
    }
}
catArray()

/**
 * 后端提供扁平化结构，前端转化为树形结构
 * temp = 
 * [{id:1,name:"集团",pid:0},{id:2,name:"子公司",pid:1},{id:3,name:"财务部门",pid:2}]
 * 变成：
 * [{id:1,name:"集团",children:[
 *  {id:2,name:"子公司",children:[
 *         {id:3,name:"财务部门"}
 *      ]}
 * ]}]
 */


